package cc.eddic.pratice.programmingparadigms.emp03objlist.impl;

import cc.eddic.pratice.programmingparadigms.Employee;
import cc.eddic.pratice.programmingparadigms.EmployeeComparator;
import cc.eddic.pratice.programmingparadigms.EmployeePredicate;
import cc.eddic.pratice.programmingparadigms.emp02list.EmployeeList;
import cc.eddic.pratice.programmingparadigms.emp03objlist.ObjectComparator;
import cc.eddic.pratice.programmingparadigms.emp03objlist.ObjectList;
import cc.eddic.pratice.programmingparadigms.emp03objlist.ObjectPredicate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class EmployeeListLxImpl extends ObjectList implements EmployeeList {
    private static final Logger log = LoggerFactory.getLogger(ResultListGcsImpl.class);

    public EmployeeListLxImpl() {
    }

    public EmployeeListLxImpl(int capacity) {
        super(capacity);
    }

    @Override
    public void add(Employee employee) {
        super.add(employee);
    }

    @Override
    public Employee get(int index) {
        return (Employee) super.get(index);
    }

    @Override
    public Employee find(EmployeePredicate predicate) {
        return (Employee) super.find(new ObjectPredicate() {
            @Override
            public boolean test(Object obj) {
                return predicate.test((Employee) obj);
            }
        });
    }

    @Override
    public void sort(EmployeeComparator comparator) {
        super.sort(new ObjectComparator() {
            @Override
            public int compare(Object o1, Object o2) {
                return comparator.compare((Employee)o1,(Employee) o2);
            }
        });
    }
}
